<template>
	<view class="brand" v-if="list && list.length > 0">
		<view class="brand-header u-flex-between">
			<view class="brand-left u-flex" @click="$navigateTo(`/subPackages/brancd-category/index`)">
				<view class="header-text">品牌合集</view>
				<view class="major-suit">优质品牌集合地</view>
			</view>
		</view>
		<view class="li-box">
			<view class="li" v-for="(item,index) in list" :key="item.id" @click="brandChange(item.id)">
				<zero-lazy-load :height="352" imgMode='aspectFill' :image="item.image" class="img"></zero-lazy-load>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {}
		},
		props: {

		},
		computed: {
			...mapState({
				brandList: (state) => state.index.brandList
			}),
			list() {
				// 最多六个
				if (Array.isArray(this.brandList)) {
					return this.brandList.slice(0, 6);
				}
				return [];
			}
		},
		methods: {
			brandChange(e) {
				this.$navigateTo(`/subPackages/brancd-category/index?brand_id=${e}`)
			},
		}
	}
</script>

<style lang="scss">
	.brand {
		padding-top: 50rpx;

		.brand-header {
			line-height: 1;

			.brand-left {
				.header-text {
					padding-right: 20rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 600;
					font-size: 36rpx;
					color: #000000;
				}

				.major-suit {
					padding-left: 10rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 400;
					font-size: 28rpx;
					color: #646464;
					border-left: 2rpx solid #707070;
				}
			}
		}

		.li-box {
			display: flex;
			flex-wrap: wrap;
			gap: 11rpx;

			.li {
				margin-top: 40rpx;

				.img {
					width: 224rpx;
					display: block;
				}
			}
		}
	}
</style>